<?php
class Mod_timkiem extends CI_Controller{
    private $tb_chuyenkhoa = 'chuyenkhoa';
    private $tb_benh = 'benh';
    private $tb_diadiem = 'diadiem';
    private $tb_phongkham = 'phongkham';
    function  __construct(){
        parent::__construct();        
        //$this->load->model('mod_timkiem/mmod_timkiem');
    }
    function index(){ // id luu torng session
         if($this->session->userdata('idchuyenkhoa')){$idchuyenkhoa = $this->session->userdata('idchuyenkhoa');}else $idchuyenkhoa=0; 
         if(!empty($idchuyenkhoa)){
            $benh = $this->home_model->get_data($this->tb_benh,array('idchuyenkhoa'=>$idchuyenkhoa));
        }else $benh = $this->home_model->get_data($this->tb_benh);
            $diadiem = $this->home_model->get_data($this->tb_diadiem);           
            $chuyenkhoa = $this->home_model->get_data($this->tb_chuyenkhoa); 
            $data = array('benh'=>$benh,'diadiem'=>$diadiem,'chuyenkhoa'=>$chuyenkhoa,'thu'=>1);
            $this->load->view('mod_timkiem/vmod_timkiem',$data);
           
        
    }
    function ajax(){
        $idchuyenkhoa = $this->uri->segment(3,0);
        $this->session->set_userdata('idchuyenkhoa',$idchuyenkhoa);
        //$idchuyenkhoa = $this->session->userdata('idchuyenkhoa'); 
        if(!empty($idchuyenkhoa)){
            $benh = $this->home_model->get_data($this->tb_benh,array('idchuyenkhoa'=>$idchuyenkhoa));
        }else $benh = $this->home_model->get_data($this->tb_benh);
            $diadiem = $this->home_model->get_data($this->tb_diadiem);           
            $chuyenkhoa = $this->home_model->get_data($this->tb_chuyenkhoa); 
            $data = array('benh'=>$benh,'diadiem'=>$diadiem,'chuyenkhoa'=>$chuyenkhoa,'thu'=>1);
            $this->load->view('mod_timkiem/vmod_boxbenh',$data);
     }
            
   
    
}